import { useCallback, useState } from "react";
import Demo8 from "./Demo8"

export default function Demo7()
{
    const [count, SetCount] = useState(0);
    const [num, SetNum] = useState(0);

    const handle = useCallback((data) =>
    {
        console.log(data);
    },[num])

    return (
        <>
            <Demo8 handle={handle} />
            <div className="main">
                <p>{count}</p>
                <p>{num}</p>
            </div>
            <div className="footer">
                <button onClick={() => SetCount(count + 1)}>count累加</button>
                <button onClick={() => SetNum(num + 1)}>num累加</button>
            </div>
        </>
    )
}